<div class="ui-bar  ui-widget ui-widget-content ui-corner-all">
<a class="ui-button ui-widget-content  ui-state-default ui-corner-all" href="<?php
            echo $this->url(
                array('module' => 'catalog', 
                      'controller'=>'product',
                      'action'=>'add', 'category_id'=>$this->category_id),
                'default', true)
                ?>"
                ><?php echo  $this->translate('Add product'); ?></a>

<a class="ui-button ui-widget-content ui-state-default ui-corner-all" href="<?php
            echo $this->url(
                array('module' => 'catalog', 'controller'=>'category', 'action'=>'add', 'parent_id'=>$this->category_id),
                'default', true)
                ?>"
                ><?php echo  $this->translate('Add subcategory'); ?></a>
</div>

<div class="ui-grid ui-widget ui-widget-content ui-corner-all">
<div class="ui-grid-header ui-widget-header ui-corner-top"><?php echo  $this->translate('Category subcategories'); ?></div>
<table class="ui-grid-content ui-widget-content" >
<thead>
    <tr>
        <th class="ui-state-default"><?php echo $this->translate('Title'); ?></th>
        <th class="ui-state-default"><?php echo $this->translate('Created at'); ?></th>
        <th class="ui-state-default"><?php echo $this->translate('Active'); ?></th>
        <th class="ui-state-default"><?php echo $this->translate('Edit'); ?></th>
    </tr>
</thead>
<tbody>
    <?php if($this->categories): foreach($this->categories as $cat):?>
    <tr>
        <td class="ui-widget-content"><?php echo $cat['title']; ?></td>
        <td class="ui-widget-content"><?php echo $cat['created_at']; ?></td>
        <td class="ui-widget-content"><?php echo $this->translate($cat['active']?'Yes':'No'); ?></td>
        <td class="ui-widget-content">
            <a href="<?php
            echo $this->url(
                array('module' => 'catalog', 'controller'=>'category', 'action'=>'admin', 'category_id'=>$cat['id']),
                'default', true)
                ?>"><?php echo $this->translate('Browse'); ?></a>

            <a href="<?php
            echo $this->url(
                array('module' => 'catalog', 'controller'=>'category', 'action'=>'edit', 'category_id'=>$cat['id']),
                'default', true)
                ?>"><?php echo $this->translate('Edit'); ?></a>

            <a href="<?php
            echo $this->url(
                array('module' => 'catalog', 'controller'=>'category', 'action'=>'move', 'category_id'=>$cat['id']),
                'default', true)
                ?>"><?php echo $this->translate('Move'); ?></a>

            <a href="<?php
            echo $this->url(
                array('module' => 'catalog', 'controller'=>'category', 'action'=>'delete', 'category_id'=>$cat['id']),
                'default', true)
                ?>"><?php echo $this->translate('Delete'); ?></a>

        </td>
    </tr>
    <?php endforeach; else:  ?>
    <tr>
        <td class="ui-widget-content ui-grid-empty" colspan="4">
            <?php echo $this->translate('No categories'); ?>
        </td>
    </tr>
    <?php endif;?>
</tbody>
</table>
<div class="ui-grid-footer ui-widget-header ui-corner-bottom ui-helper-clearfix">
    
</div>
</div>

<div class="ui-grid ui-widget ui-widget-content ui-corner-all">
<div class="ui-grid-header ui-widget-header ui-corner-top"><?php echo  $this->translate('Category products'); ?></div>
<table class="ui-grid-content ui-widget-content" >
<thead>
    <tr>
        <th class="ui-state-default"><?php echo $this->translate('Image'); ?></th>
        <th class="ui-state-default"><a href="<?php echo $this->url(array(
                                                 'module' => 'catalog',
                                                 'controller'=>'category',
                                                 'action'=>'admin',
                                                 'category_id' => $this->category_id,
                                                 'sort'=>'p.title'))?>">
                                                 <span class="ui-icon ui-icon-triangle-1-s" title="sort ascending"></span><?php echo $this->translate('Title'); ?></a></th>
        <th class="ui-state-default"><a href="<?php echo $this->url(array(
                                                 'module' => 'catalog',
                                                 'controller'=>'category',
                                                 'action'=>'admin',
                                                 'category_id' => $this->category_id,
                                                 'sort'=>'p.short_description'))?>"><span class="ui-icon ui-icon-triangle-1-s" title="sort ascending"></span><?php echo $this->translate('Short description'); ?></a></th>
        <th class="ui-state-default"><a href="<?php echo $this->url(array(
                                                 'module' => 'catalog',
                                                 'controller'=>'category',
                                                 'action'=>'admin',
                                                 'category_id' => $this->category_id,
                                                 'sort'=>'p.created_at'))?>"><span class="ui-icon ui-icon-triangle-1-s" title="sort ascending"></span><?php echo $this->translate('Created at'); ?></a></th>
        <th class="ui-state-default"><a href="<?php echo $this->url(array(
                                                 'module' => 'catalog',
                                                 'controller'=>'category',
                                                 'action'=>'admin',
                                                 'category_id' => $this->category_id,
                                                 'sort'=>'p.active'))?>"><span class="ui-icon ui-icon-triangle-1-s" title="sort ascending"></span><?php echo $this->translate('Active'); ?></a></th>
        <th class="ui-state-default"><?php echo $this->translate('Edit'); ?></th>
    </tr>
</thead>
<tbody>
    <?php if(count($this->products)): foreach($this->products as $product):?>
    <tr>
        <td style="width:100px" class="ui-widget-content">
            <a href="<?php
                echo $this->url(
                    array('module' => 'catalog', 'controller'=>'product', 'action'=>'image', 'product_id'=>$product['id']),
                    'default', true)
                ?>" rel="img-dialog">
                    <img src="<?php
                        echo $this->url(
                            array('module' => 'catalog', 'controller'=>'product', 'action'=>'thumb', 'product_id'=>$product['id']    ),
                        'default', true)
                    ?>"/>
            </a>
        </td>
        <td class="ui-widget-content"><?php echo $product['title']; ?></td>
        <td class="ui-widget-content"><?php echo $product['short_description']; ?></td>
        <td class="ui-widget-content"><?php echo $product['created_at']; ?></td>
        <td class="ui-widget-content"><?php echo $this->translate($product['active']?'Yes':'No'); ?></td>
        <td class="ui-widget-content">
            <a href="<?php
            echo $this->url(
                array('module' => 'catalog', 'controller'=>'product', 'action'=>'edit', 'product_id'=>$product['id']),
                'default', true)
                ?>"><?php echo $this->translate('Edit'); ?></a>

            <a href="<?php
            echo $this->url(
                array('module' => 'catalog', 'controller'=>'special', 'action'=>'add', 'product_id'=>$product['id']),
                'default', true)
                ?>"><?php echo $this->translate('Make special'); ?></a>

            <a href="<?php
            echo $this->url(
                array('module' => 'catalog', 'controller'=>'product', 'action'=>'move', 'product_id'=>$product['id']),
                'default', true)
                ?>"><?php echo $this->translate('Move'); ?></a>

            <a href="<?php
            echo $this->url(
                array('module' => 'catalog', 'controller'=>'product', 'action'=>'delete', 'product_id'=>$product['id']),
                'default', true)
                ?>"><?php echo $this->translate('Delete'); ?></a>

        </td>
    </tr>
    <?php endforeach; else:  ?>
    <tr>
        <td class="ui-widget-content ui-grid-empty" colspan="6">
            <?php echo $this->translate('No products'); ?>
        </td>
    </tr>
    <?php endif;?>
</tbody>
</table>
<div class="ui-grid-footer ui-widget-header ui-corner-bottom ui-helper-clearfix">
    <?php echo $this->paginationControl($this->products); ?>
</div>
</div>

